package com.uottawa.library.domain;

import java.util.HashMap;

import javax.print.attribute.standard.NumberOfDocuments;

public class ItemFactory {

	private static final HashMap<Integer, Item> itemsByTitle = new HashMap<Integer, Item>();
	public static int numberOfItems; 
	
	public static Item getItem (Integer id, Title title){
		Item item = (Item)itemsByTitle.get(title.getIsbn());
		if(item == null){
			item = new Item(id, title.getIsbn());	
			itemsByTitle.put(title.getIsbn(), item);
		}
		item.setItemId(id);
		numberOfItems = itemsByTitle.size();
		return item;
	}
}
